﻿@model IEnumerable<TO3.Models.Match>

@{
    ViewBag.MatchError = Session["ErrorMessage"];
    Session["ErrorMessage"] = "";
}

<p>
    @Html.ActionLink("Create New", "Create") |
    @Html.ActionLink("Match All", "MatchAll")
    @Html.Raw(ViewBag.MatchError)
</p>
<table class="table">
    <tr>
        <th>
            Spiller 1
        </th>
        <th>
            Spiller 2
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Tournament.Name)
        </th>
        <th>
            Vinder
        </th>
        <th>
            @Html.DisplayNameFor(model => model.TableId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Round)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Player1CP)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Player2CP)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Player1.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Player2.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Tournament.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Winner.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TableId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Round)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Player1CP)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Player2CP)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
        </td>
    </tr>
}

</table>
